package com.example.onlinemusicserver2024.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.onlinemusicserver2024.common.R;
import com.example.onlinemusicserver2024.mapper.RecommendMapper;
import com.example.onlinemusicserver2024.model.domain.Recommend;
import com.example.onlinemusicserver2024.service.RecommendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RecommendServiceImpl extends ServiceImpl<RecommendMapper, Recommend> implements RecommendService {
    @Autowired
    RecommendMapper recommendMapper;

    @Override
    public R songRecommendByUserId(int userId) {
        QueryWrapper<Recommend> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_id", userId);
        List<Recommend> recommends = recommendMapper.selectList(queryWrapper);
        return R.success("查询成功", recommends);
    }
}
